/**
 * ViewMenuController
 * 
 * Version 1.0
 *
 * Nov 29th, 2009
 * 
 * Copyright (c) 2009 Duc Nguyen
 */
import java.awt.event.ActionEvent;
/**
 * View menu controller opens new view on the desktop using brick frame
 * @author Duc Nguyen
 *
 */

public class ViewMenuController extends BrickController {
	
	/**
	 * Constructor
	 * @param frame		the brick frame 
	 */
	ViewMenuController(BrickFrame frame){
		super(frame);
	}
	
	/**
	 * creates views
	 */
	@Override
	public void actionPerformed(ActionEvent arg0) {
		String cmmd = arg0.getActionCommand();
		
		if(cmmd.equals("Open Side View")){
			this.getFrame().addView(new SideView(this.getModel()));
		}
		
		if(cmmd.equals("Open Top View")){
			this.getFrame().addView(new TopView(this.getModel()));
		}
		
		if(cmmd.equals("Open Front View")){
			this.getFrame().addView(new FrontView(this.getModel()));
		}
		
		if(cmmd.equals("Open Data View")){
			DataView view = new DataView(this.getModel());
			DataViewController controller = new DataViewController(getFrame(), view);
			view.setController(controller);
			this.getFrame().addView(view);
		}
	}
}
